package hci.timemanager;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class NewEventSetting extends Activity {
	/** Called when the activity is first created. */
	private Button button1 = null;
	private Button button2 = null;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.neweventsetting);
		button1 = (Button) findViewById(R.id.button1);
		button1.setOnClickListener(new Button1Listener());

		button2 = (Button) findViewById(R.id.button2);
		button2.setOnClickListener(new Button2Listener());

	}


	class Button1Listener implements OnClickListener {

		public void onClick(View v) {
			// TODO Auto-generated method stub
//			Intent intent = new Intent();
//			intent.setClass(NewEventSetting.this, Main.class);
//			NewEventSetting.this.startActivity(intent);
			
			//create the dialog
			Dialog dialog = new AlertDialog.Builder(NewEventSetting.this)
			.setTitle("Reminder")
			.setMessage("Not any details about this event?")
			//set Natural Button in the dialog
			.setNeutralButton("Set Detail", new DialogInterface.OnClickListener() {
                  	public void onClick(DialogInterface dialog, int whichButton) {
            			Intent intent = new Intent();
            			intent.setClass(NewEventSetting.this, EventDetailSetting.class);
            			intent.putExtra("from", "NewEventSetting");
            			NewEventSetting.this.startActivity(intent);
                    }
                })
			//set Positive Button in the dialog
			.setPositiveButton("Nop", 
	            new DialogInterface.OnClickListener() 
	            {
	                public void onClick(DialogInterface dialog, int whichButton)
	                {
	        			Intent intent = new Intent();
	        			intent.setClass(NewEventSetting.this, Main.class);
            			intent.putExtra("from", "NewEventSetting");
	        			NewEventSetting.this.startActivity(intent);
	                }
	            })
	         //set Negative Button in the dialog
	         .setNegativeButton("Not next time", 
	            new DialogInterface.OnClickListener() 
	            {
	                public void onClick(DialogInterface dialog, int whichButton)
	                {
	                	dialog.dismiss();
	                	onResume();
	                }
	            })
	        .create();
			dialog.show();
			

		}

	}

	class Button2Listener implements OnClickListener {

		public void onClick(View v) {
			// TODO Auto-generated method stub
			Intent intent = new Intent();
			intent.setClass(NewEventSetting.this, EventDetailSetting.class);
			intent.putExtra("from", "NewEventSetting");
			NewEventSetting.this.startActivity(intent);

		}

	}


}